package trss.config;


import javax.faces.context.FacesContext;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.orm.jpa.JpaTransactionManager;

import trss.webapp.repository.AppEngineEntityManagerFactory;

/**
 *
 * @author Igor Khoroshev
 */
@Configuration
public class AppConfig {

    

    @Bean
    EntityManagerFactory entityManagerFactory() {
        final AppEngineEntityManagerFactory factoryBean = new AppEngineEntityManagerFactory("person-pu");
        return factoryBean.entityManagerFactory();
    }

    @Bean
    JpaTransactionManager transactionManager() {
        final JpaTransactionManager transactionManager = new JpaTransactionManager();
        transactionManager.setEntityManagerFactory(entityManagerFactory());
        return transactionManager;
    }

}
